package cn.iocoder.yudao.hires.mapper;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.hires.entity.ResumeIntentionDO;
import cn.iocoder.yudao.hires.vo.ResumeIntentionPageReqVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 简历-求职意向 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface ResumeIntentionMapper extends BaseMapperX<ResumeIntentionDO> {

    default PageResult<ResumeIntentionDO> selectPage(ResumeIntentionPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ResumeIntentionDO>()
                .eqIfPresent(ResumeIntentionDO::getUserId, reqVO.getUserId())
                .eqIfPresent(ResumeIntentionDO::getIntentionPost, reqVO.getIntentionPost())
                .eqIfPresent(ResumeIntentionDO::getIntentionPostName, reqVO.getIntentionPostName())
                .eqIfPresent(ResumeIntentionDO::getIntentionIndustryCode, reqVO.getIntentionIndustryCode())
                .eqIfPresent(ResumeIntentionDO::getIntentionIndustry, reqVO.getIntentionIndustry())
                .eqIfPresent(ResumeIntentionDO::getIntentionCity, reqVO.getIntentionCity())
                .eqIfPresent(ResumeIntentionDO::getIntentionSalaryMin, reqVO.getIntentionSalaryMin())
                .eqIfPresent(ResumeIntentionDO::getIntentionSalaryMax, reqVO.getIntentionSalaryMax())
                .eqIfPresent(ResumeIntentionDO::getIntentionSalary, reqVO.getIntentionSalaryMax())
                .eqIfPresent(ResumeIntentionDO::getIntentionSalaryName, reqVO.getIntentionSalaryMax())
                .eqIfPresent(ResumeIntentionDO::getArrivalTime, reqVO.getArrivalTime())
                .eqIfPresent(ResumeIntentionDO::getArrivalTimeName, reqVO.getArrivalTimeName())
                .eqIfPresent(ResumeIntentionDO::getJobSearchStatus, reqVO.getJobSearchStatus())
                .eqIfPresent(ResumeIntentionDO::getDeleted, 0)
                .eqIfPresent(ResumeIntentionDO::getJobSearchStatusName, reqVO.getJobSearchStatusName())
                .betweenIfPresent(ResumeIntentionDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(ResumeIntentionDO::getId));
    }

    List<String> getIntentionIds(@Param("userId") Long userId);
}